/*
import java.util.*;
public class Solution {
    public boolean isValid (String s) {
        Stack<Character> stack = new Stack<>();
        for(int i = 0;i<s.length();i++){
            char ch = s.charAt(i);
            if(ch=='['||ch=='{'||ch=='('){
                stack.push(ch);
            }else{
                if(stack.empty()){
                    return false;
                }
                int top = stack.peek();
                if((ch=='}'&&top=='{')||
                        (ch==')'&&top=='(')||
                        (ch==']'&&top=='[')){
                    stack.pop();
                }else{
                    return false;
                }
            }
        }
        return stack.empty();
    }
}*/






/*

import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.*;
class Solution {
    public ArrayList<Integer> GetLeastNumbers_Solution(
            int [] input, int k) {
        ArrayList<Integer>list = new ArrayList<>();
        PriorityQueue<Integer>queue = new PriorityQueue<>();
        for(int i = 0;i<input.length;i++){
            queue.offer(input[i]);
        }
        for(int i = 0;i<k;i++) {
            list.add(queue.poll());
        }
        return list;
    }
}
import java.util.ArrayList;
        import java.util.PriorityQueue;
        import java.util.*;
class compare implements Comparator<Integer>{
    public int  compare(Integer o1, Integer o2){
        return o2.compareTo(o1);
    }
}
public class Solution {
    public ArrayList<Integer> GetLeastNumbers_Solution(
            int [] input, int k) {
        ArrayList<Integer>list = new ArrayList<>();
        if(k==0){
            return list;
        }
        PriorityQueue<Integer>queue = new PriorityQueue<>(new compare());
        for(int i = 0;i<k;i++){
            queue.offer(input[i]);
        }
        for(int i = k;i<input.length;i++) {
            if(input[i]<queue.peek()){
                queue.poll();
                queue.offer(input[i]);
            }
        }
        for(int i = 0;i<k;i++){
            list.add(queue.poll());
        }
        return list;
    }
}*/


/*

import java.util.*;
public class Solution {
    public int findKth (int[] a, int n, int K) {
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        for(int i = 0;i<K;i++){
            queue.offer(a[i]);
        }
        for(int i = K;i<n;i++){
            if(a[i]>queue.peek()){
                queue.poll();
                queue.offer(a[i]);
            }
        }
        return queue.poll();
    }
}
*/

/*
import java.util.*;
public class Solution {
    public ArrayList<Integer> maxInWindows(int [] num, int size) {
        ArrayList<Integer>list =  new ArrayList<>();
        if(size==0){
            return list;
        }
        int start = 0;
        while(start<num.length){
            int max = 0;
            int end =start+size-1;
            if(end>=num.length){
                break;
            }
            for(int i = start; i<=end;i++){
                if(num[i]>max){
                    max=num[i];
                }
            }
            list.add(max);
            start++;
        }
        return list;
    }
}*/
/*import java.util.*;
class Solution {
    //小顶堆，元素数值都比大顶堆大
    private PriorityQueue<Integer> max = new PriorityQueue<>();
    //大顶堆，元素数值较小
    private PriorityQueue<Integer> min = new PriorityQueue<>((o1, o2)->o2.compareTo(o1));
    //维护两个堆，取两个堆顶部即与中位数相关
    public void Insert(Integer num) {
        //先加入较小部分
        min.offer(num);
        //将较小部分的最大值取出，送入到较大部分
        max.offer(min.poll());
        //平衡两个堆的数量
        if(min.size() < max.size())
            min.offer(max.poll());
    }
    public Double GetMedian() {
        //奇数个
        if(min.size() > max.size())
            return (double)min.peek();
        else
            //偶数个
            return (double)(min.peek() + max.peek()) / 2;
    }
}*/






















